const { exec } = require('../db/mysql')

// 获取站点信息
const getSiteInfo = params => {
  let sql = `select * from site`
  return exec(sql)
}

// 更新站点信息
const updateSiteInfo = params => {
  const { name = '', keyword = '', description = '', iconUrl = '' } = params
  let sql = `update site set name='${name}', keyword='${keyword}', description='${description}', iconUrl='${iconUrl}'`
  return exec(sql).then(data => {
    if (data.affectedRows > 0) {
      return true
    } else {
      return false
    }
  })
}

module.exports = {
  getSiteInfo,
  updateSiteInfo
}
